package com.hudongwx.food.login_fargment;


import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

import com.hudongwx.food.R;

import org.xutils.view.annotation.ContentView;
import org.xutils.x;

/**
 * A simple {@link Fragment} subclass.
 */
@ContentView(R.layout.fragment_yunma)
public class YunmaFragment extends Fragment {
    private View view;
    private EditText et1, et2;
    private Button btn;


    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        if (null==view){
            view = x.view().inject(this, inflater, container);
            et1 = (EditText) view.findViewById(R.id.yunma_acc);
            et2 = (EditText) view.findViewById(R.id.yunma_pwd);
            btn = (Button) view.findViewById(R.id.yunma_button);
            btn.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Log.i("", "onClick: "+ (et1.getText().length()==0));
                    if (et1.getText().length()==0){
                        Toast.makeText(getActivity(),"云码不能为空",Toast.LENGTH_LONG).show();

                    }else if (et2.getText().length()==0){
                        Toast.makeText(getActivity(),"密码不能为空",Toast.LENGTH_LONG).show();
                    }

                }
            });
        }
        return view;
    }

}
